#include "log.h"
#include <iostream>

int Log::maxOccLength = 0;
const int Log::maxLength = 15;


Log::Log(QObject *parent) {
    this->parent = parent;
}

Log::Log(QString className, QObject *parent) {
    this->parent = parent;
    this->className = className;

    if (this->className.size() > Log::maxLength) {
         this->className.resize(Log::maxLength);
    }
    if (this->className.size() > Log::maxOccLength) {
        Log::maxOccLength = this->className.size();
    }
}

void Log::print(QString message) {
    cout << this->className.leftJustified(Log::maxOccLength,' ') << ": " << message << endl;
}
